package stack.era.presentation.hud;

import java.awt.Color;

import stack.era.domain.DomainHome;
import stack.era.presentation.ERAInfoBar;

public class PlayerHealthBar extends ERAInfoBar {

	private static final long serialVersionUID = -4368845521013202958L;

	public PlayerHealthBar() {
		super(new Color(230, 50, 50));

		this
				.setToolTipText("<html><body>Health determines how much punishment your body can take<br>before death occurs. When your health reaches zero, you die.</body></html>");
	}

	public void populate() {
		DomainHome domain = DomainHome.getInstance();
		String playerCharName = domain.getWorld().getPlayerCharacterName();
		if (playerCharName != null) {
			this.value = domain.getCharacter(playerCharName).getHealth();
			this.maxValue = domain.getCharacter(playerCharName).getMaxHealth();
		}
	}

	@Override
	public String getBarString() {
		return this.value + "/" + this.maxValue;
	}

}
